<?php
	set_include_path (PHPPATH);
	require_once 'MDB2.php';
	/**
	 * 
	 * The sales controller
	 * @author Tri
	 *
	 */
	class sales extends Application 
	{
		/**
		 * 
		 * Constructor
		 */
		function __construct(&$tmpl)
		{			
			$this->tmpl = &$tmpl;		
		}

		/**
		 * 
		 * Default action
		 */
		function index()
		{	
			$userId = $this->getLoggedUser();
			if($userId == 0) {
				$this->assign("loginRightVisible", 1);
			}
			
			$productModel = $this->getModel('ProductModel');
            $products = $productModel->getSalesProducts();
            $this->assign("products", $products);
            $this->assign("products_count", count($products));
			
            $this->assign("imagesPath", $this->loadResources('images'));
            $this->assign("productPath", $this->loadResources('product'));
			
			$this->assign("title", "Sales");
			$this->assign("page", "home");
			$this->assign("pageId", '');
			$this->assign("currentView", "sales");
			$this->loadTemplate('sales_page');
		}
	}
?>